from bokeh.models import Select, CustomJS, ColumnDataSource
from bokeh.layouts import column
from numpy import number

x_value = 'goals'
y_value = 'birth_month_number'

full_source = ColumnDataSource(nhl_player_stats_team_df)

source = ColumnDataSource(
    data=dict(
        x=nhl_player_stats_team_df[x_value],
        y=nhl_player_stats_team_df[y_value],
    )
)

plot = figure(width=400, height=200, title="test")
plot.circle(
    'x', 
    'y', 
    source=source, 
    fill_alpha=0.2,
    size=1
)


numeric_cols = nhl_player_stats_team_df.select_dtypes([number]).columns.tolist()
x_select = Select(title="X Axis", options=numeric_cols, value=x_value)
x_select.js_on_change("value", CustomJS(args=dict(source=source, data=full_source), code="""
    console.log(`this is the selected value: ${this.value}`);
    console.log(source.data['x'])
    console.log(data.data)
    source.data['x'] = data.data[this.value]
    source.change.emit();
"""))
layout = column(x_select, plot)
show(layout)
x = 'goals'
y = 'shots'
graph1 = figure(title="NHL Data", x_axis_label=x, y_axis_label=y)
months = nhl_player_stats_team_df['birth_month'].unique()
#graph1.circle(nhl_player_stats_team_df[x], nhl_player_stats_team_df[y], legend_label='test')
for month in months:
    month_df = nhl_player_stats_team_df[nhl_player_stats_team_df['birth_month'] == month]
    graph1.circle(month_df[x], month_df[y], legend_label=month)
graph1.legend.click_policy="hide"
show(graph1)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_12200/955611271.py in <module>
----> 1 show(graph1)

NameError: name 'show' is not defined